-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gnovm): Fix panic when calling len()
/cap()
on pointer array
#2709
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2709 +/- ##
==========================================
- Coverage 60.85% 60.84% -0.01%
==========================================
Files 563 563
Lines 75169 75190 +21
==========================================
+ Hits 45741 45749 +8
- Misses 26062 26073 +11
- Partials 3366 3368 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hello, @notJoon thanks for the fix 🙏, Can you fix the cap function that suffers from the same problem too func main() {
exp := [...]string{"HELLO"}
x := cap(&exp)
println(x)
} |
modified the |
len()
on pointer arraylen()
/cap()
on pointer array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix Joon. Can you also make these changes in the if tv.V == nil
blocks so that something like this won't crash the VM?
package main
func main() {
printLen(nil)
}
func printLen(arr *[2]int) {
println(len(arr))
}
I just added a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 💪
Description
closes #2707
The
GetLength()
,GetCapacity()
method inTypedValue
has been updated to handle pointer type.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description